<template>
  <div @click="getDetail()" class="main">
    <img :src="item.imgUrl"/>
    <div class="desc">
      <span>{{item.name}}</span>
      <div>
        <span class="price">￥{{item.price}}</span>
        <span class="payed-num">{{item.payedNum}}人付款</span>
      </div>
      <span class="address">{{item.address}}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SearchItem',
  props: {
    item: Object
  },
  methods: {
    getDetail () {
      this.$router.push({name: 'ItemDetail', query: {id: this.item.id}})
    }
  }
}
</script>

<style scoped lang="less">
  .main {
    display: flex;
    font-size: 0.25rem;
    background-color: white;
    height: 2rem;
    margin-bottom: 0.1rem;
    border-radius: 0.2rem;
    overflow: hidden;

    img {
      width: 2rem
    }
    .desc {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      text-align: start;
      margin: 0.1rem 0.2rem
    }
    .price {
      font-size: 0.3rem;
      color: orangered
    }
    .payed-num{
      font-size:0.2rem;color: lightgrey
    }
    .address{
      font-size:0.2rem;color: darkgrey
    }
  }

</style>
